package cn.kust.clock.pojo.entity;

import cn.kust.clock.pojo.dto.ClockDTO;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

/**
 * @author bjs
 * @date 2022/7/20 0020  15:19
 * 打卡实体对象
 **/
@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName("clock_clock")
public class Clock {
    private Long id;//打卡id

    private Long userId;//用户id

    private String title;//打卡标题

    private String content;//打卡正文

    private String position;//打卡地址

    private String location;//经纬度

    private String tags;//打卡标签

    private LocalDateTime gmtCreate;//创建时间

    private LocalDateTime gmtModified;//修改时间

    /**
     *
     * 用于进行前端写入打卡
     * @param clockDTO 前端传过来的form表单
     * @param gmtCreate 创建这条数据的时间
     */
    public Clock( ClockDTO clockDTO,String position, LocalDateTime gmtCreate) {
        this.userId = clockDTO.getUserId();
        this.title = clockDTO.getTitle();
        this.position = position;
        this.content = clockDTO.getContent();
        this.location = clockDTO.getLocation();
        this.tags = clockDTO.getTags();
        this.gmtCreate = gmtCreate;
    }
}
